<template>
  <el-dialog :show-close=false
             :close-on-press-escape=false
             :close-on-click-modal=false
             width="1000px"
             :title="isNew?$getTextByLangKey('新增'):$getTextByLangKey('编辑')"
             :visible.sync="dialogVisible"
             @keyup.enter.native="confrimDialog">

    <el-row style="margin-bottom: 30px">


<!--      <el-col :span="22">-->
<!--        <div class="item">-->
<!--          <span class="label">{{$getTextByLangKey('产线')+'：'}}</span>-->
<!--          <el-select :placeholder="$getTextByLangKey('请选择产线')" v-model ="formData.lineName" @change="handleLineNameChange">-->
<!--            <el-option-->
<!--              v-for="item in lineList"-->
<!--              :key="item.lineName"-->
<!--              :label="item.lineName"-->
<!--              :value="item.lineName"-->
<!--            >-->
<!--            </el-option>-->
<!--          </el-select>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="23">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('产线')+'：'}}</span>
          <el-input v-model="formData.lineName"></el-input>

          <el-button type="primary"
                     @click="handleUseDefaultValue"
                     style="margin-left: 10px;"

          >{{$getTextByLangKey('引用默认值')}}</el-button>
        </div>

      </el-col>


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp0')+'：'}}</span>
          <el-input v-model="formData.sp0"></el-input>
        </div>
      </el-col>

<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv0')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv0"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp1')+'：'}}</span>
          <el-input v-model="formData.sp1"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv1')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv1"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp2')+'：'}}</span>
          <el-input v-model="formData.sp2"></el-input>
        </div>
      </el-col>

<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv2')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv2"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp3')+'：'}}</span>
          <el-input v-model="formData.sp3"></el-input>
        </div>
      </el-col>

<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv3')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv3"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp4')+'：'}}</span>
          <el-input v-model="formData.sp4"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv4')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv4"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp5')+'：'}}</span>
          <el-input v-model="formData.sp5"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv5')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv5"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp6')+'：'}}</span>
          <el-input v-model="formData.sp6"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv6')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv6"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp7')+'：'}}</span>
          <el-input v-model="formData.sp7"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv7')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv7"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp8')+'：'}}</span>
          <el-input v-model="formData.sp8"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv8')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv8"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp9')+'：'}}</span>
          <el-input v-model="formData.sp9"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv9')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv9"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->

      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp10')+'：'}}</span>
          <el-input v-model="formData.sp10"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv10')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv10"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp11')+'：'}}</span>
          <el-input v-model="formData.sp11"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv11')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv11"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp12')+'：'}}</span>
          <el-input v-model="formData.sp12"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv12')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv12"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp13')+'：'}}</span>
          <el-input v-model="formData.sp13"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv13')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv13"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp14')+'：'}}</span>
          <el-input v-model="formData.sp14"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv14')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv14"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp15')+'：'}}</span>
          <el-input v-model="formData.sp15"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv15')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv15"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp16')+'：'}}</span>
          <el-input v-model="formData.sp16"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv16')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv16"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp17')+'：'}}</span>
          <el-input v-model="formData.sp17"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv17')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv17"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp18')+'：'}}</span>
          <el-input v-model="formData.sp18"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv18')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv18"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


      <el-col :span="5">
        <div class="item">
          <span class="label small-label">{{$getTextByLangKey('sp19')+'：'}}</span>
          <el-input v-model="formData.sp19"></el-input>
        </div>
      </el-col>
<!--      <el-col :span="5">-->
<!--        <div class="item">-->
<!--          <span class="label small-label">{{$getTextByLangKey('pv19')+'：'}}</span>-->
<!--          <el-input v-model="formData.pv19"></el-input>-->
<!--        </div>-->
<!--      </el-col>-->


    </el-row>


    <span slot="footer" class="dialog-footer">
        <el-button @click="cancelDialog">{{$getTextByLangKey('取消')}}</el-button>
        <el-button type="primary"
                   @click="confrimDialog"

        >{{$getTextByLangKey('确定')}}</el-button>
      </span>
  </el-dialog>
</template>
<script>

  import request from '@/common/js/request'
  import util from '@/common/js/util'

  export default {
    name: "search-action-componet",
    props: ['dialogVisible','formData','rowIndex','isNew','lineList'],
    data() {
      return {
      }
    },
    created: function () {

    },
    methods: {

      fetchReflowLastTemp(lineName){
        request.requestGetReflowLastTempByLineName({lineName},res=>{

          if(res.data.code === 200){
            const data = res.data.data
            this.formData.sp0 = data.sp0
            // this.formData.pv0 = data.pv0
            this.formData.sp1 = data.sp1
            // this.formData.pv1 = data.pv1
            this.formData.sp2 = data.sp2
            // this.formData.pv2 = data.pv2
            this.formData.sp3 = data.sp3
            // this.formData.pv3 = data.pv3
            this.formData.sp4 = data.sp4
            // this.formData.pv4 = data.pv4
            this.formData.sp5 = data.sp5
            // this.formData.pv5 = data.pv5
            this.formData.sp6 = data.sp6
            // this.formData.pv6 = data.pv6
            this.formData.sp7 = data.sp7
            // this.formData.pv7 = data.pv7
            this.formData.sp8 = data.sp8
            // this.formData.pv8 = data.pv8
            this.formData.sp9 = data.sp9
            // this.formData.pv9 = data.pv9
            this.formData.sp10 = data.sp10
            // this.formData.pv10 = data.pv10
            this.formData.sp11 = data.sp11
            // this.formData.pv11 = data.pv11
            this.formData.sp12 = data.sp12
            // this.formData.pv12 = data.pv12
            this.formData.sp13 = data.sp13
            // this.formData.pv13 = data.pv13
            this.formData.sp14 = data.sp14
            // this.formData.pv14 = data.pv14
            this.formData.sp15 = data.sp15
            // this.formData.pv15 = data.pv15
            this.formData.sp16 = data.sp16
            // this.formData.pv16 = data.pv16
            this.formData.sp17 = data.sp17
            // this.formData.pv17 = data.pv17
            this.formData.sp18 = data.sp18
            // this.formData.pv18 = data.pv18
            this.formData.sp19 = data.sp19
            // this.formData.pv19 = data.pv19



            console.log('this.formData',this.formData)
            this.$forceUpdate()
          }
        },err=>{
          this.$message.error(err.data.message || 'error')
        })
      },
      handleUseDefaultValue(){

        if(!this.formData.lineName){
          this.$message.error('请输入产线名称')
          return
        }

        this.fetchReflowLastTemp(this.formData.lineName)


      },
      handleLineNameChange(){

      },
      cancelDialog: function () {
        this.$emit('cancelDialog')
      },
      confrimDialog: function () {
        if(!this.formData.lineName){
          this.$message.error('请输入产线名称')
          return
        }
        this.$emit('confrimDialog', this.formData,this.rowIndex)
      }
    }
  }

</script>

<style >

  /*.div-search-action {*/
    /*line-height: 50px;*/

  /*}*/

  /deep/ label.el-form-item__label{
    width: 150px !important;
  }

  /deep/  .el-form-item__content{
    margin-left: 150px !important;
  }

  /deep/ .first-el-select{
    padding-left: 10px;
  }
  /deep/  .el-button-delete-data{
    margin-left: 10px;
  }
  .el-dialog__body {
    padding-top: 10px;
    padding-bottom: 0px;
  }

  .el-dialog__footer {
    padding-top: 0px;
  }

  .el-form-left {
    margin-right: 10px;
  }

  .el-form-right {
    margin-left: 10px;
  }
</style>

<style scoped>
  .item{
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    width: 100%;

  }

  .item .el-select{
    flex: 1;
  }

  .label{
    width: 120px;
    flex-shrink: 0;
    text-align: right;
  }
  .label.small-label{
    width: 80px;
  }
</style>
